import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Storage } from '@ionic/storage';
import {SQLite, SQLiteObject} from '@ionic-native/sqlite';


import { Tabs } from '../pages/tabs/tabs';
import { Login } from '../pages/lrf/login/login';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {

  rootPage:any = Login;
  database: SQLiteObject;
  constructor(
    platform: Platform,
    statusBar: StatusBar,
    splashScreen: SplashScreen,
    public storage:Storage,
    private sqlite: SQLite
  ) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      splashScreen.hide();
    });
    storage.get("isLogin").then(value=> {
      //初始化---- 判断登陆状态
      if (value) {
        storage.get("userInfo").then(data => {
            this.rootPage = Tabs;
        })
      }
      else {
        this.rootPage = Login;
      }
    });
  }
}
